package org.come.Frame;

import com.updateNew.MyIsif;
import org.come.until.*;
import come.tool.Fighting.FightingMixDeal;

import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import com.tool.tcpimg.UIUtils;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import javax.swing.BorderFactory;
import java.awt.Component;

import org.come.Jpanel.MsgJapnel5;
import java.awt.event.MouseListener;
import javax.swing.JInternalFrame;



//新版战斗自动显示
public class MsgJframe5 extends JInternalFrame implements MouseListener {
    private MsgJapnel5 japnel5;
    private int first_x;
    private int first_y;

    public static MsgJframe5 getMsJframe5() {
        return (MsgJframe5)FormsManagement.getInternalForm(634).getFrame();
    }

    public MsgJframe5() {
        this.add((Component)(this.japnel5 = new MsgJapnel5()));
        this.setBorder(BorderFactory.createEmptyBorder());
        ((BasicInternalFrameUI)this.getUI()).setNorthPane(null);
        this.setBounds(ScrenceUntil.Screen_x - 220, ScrenceUntil.Screen_y - 176, 150, 94);
        this.setBackground(UIUtils.Color_BACK);
        this.pack();
        this.setDefaultCloseOperation(3);
        this.setVisible(false);
        this.addMouseListener((MouseListener)this);
        this.addMouseMotionListener(new MouseMotionListener() {
            @Override
            public void mouseMoved(final MouseEvent e) {
                if (MessagrFlagUntil.ImgFlagImg.equals(MessagrFlagUntil.MOUSE13)) {
                    MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE1);
                }
            }

            @Override
            public void mouseDragged(final MouseEvent e) {
                if (MsgJframe5.this.isVisible()) {
                    final int x = e.getX() - MsgJframe5.this.first_x;
                    final int y = e.getY() - MsgJframe5.this.first_y;
                    MsgJframe5.this.setBounds(x + MsgJframe5.this.getX(), y + MsgJframe5.this.getY(), MsgJframe5.this.getWidth(), MsgJframe5.this.getHeight());
                }
            }
        });
    }

    public MsgJapnel5 getJapnel5() {
        return this.japnel5;
    }

    public void setJapnel5(final MsgJapnel5 japnel5) {
        this.japnel5 = japnel5;
    }

    @Override
    public void mouseClicked(final MouseEvent e) {
    }

    @Override
    public void mousePressed(final MouseEvent e) {
        FormsManagement.showForm(289);
        Music.addyinxiao("关闭窗口.mp3");
        if (e.isMetaDown()) {
            FightingMixDeal.zdhh = 0;
            FormsManagement.HideForm(634);
            try {
                if("水墨UI".equals(MyIsif.getStyle())) {
                    ZhuFrame.getZhuJpanel().getZidong().setIcons(CutButtonImage.cuts("skin/8100226/newbutton/aj1.png"));

                    ZhuFrame.getZhuJpanel().getZidong().setText("自动");

                }else{
                    ZhuFrame.getZhuJpanel().getZidong().setIcons(CutButtonImage.cuts("inkImg/hongmu/1/6026.png"));

                    ZhuFrame.getZhuJpanel().getZidong().setText("自动");
                }

            }
            catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        else {
            FormsManagement.Switchinglevel(634);
        }
        this.first_x = e.getX();
        this.first_y = e.getY();
    }

    @Override
    public void mouseReleased(final MouseEvent e) {
    }

    @Override
    public void mouseEntered(final MouseEvent e) {
    }

    @Override
    public void mouseExited(final MouseEvent e) {
    }
}
